<?php

use yii\widgets\ActiveForm;
use common\helpers\Url;
use common\enums\StatusEnum;
use common\enums\GenderEnum;
use yii\helpers\ArrayHelper;

$form = ActiveForm::begin([
    'id' => $model->formName(),
    'enableAjaxValidation' => true,
    'class' => 'form-horizontal',
    'validationUrl' => Url::to(['ajax-edit', 'id' => $model['id']]),
    'fieldConfig' => [
        'template' => "<div class='col-sm-3 text-right'>{label}</div><div class='col-sm-9'>{input}\n{hint}\n{error}</div>",
    ]
]);
?>

    <div class="modal-content">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true" onclick="history.go(-1)">×</span></button>
            <h4 class="modal-title">基本信息</h4>
        </div>
        <div class="modal-body">
            <?= $form->field($model, 'member_cate_id')->dropDownList(ArrayHelper::map($MemberCate,'id','name'));?>
            <?= $form->field($model, 'head_portrait')->widget('common\widgets\webuploader\Files', [
                'type' => 'files',
                'config' => [ // 配置同图片上传
                    // 'server' => \yii\helpers\Url::to(['file/files']), // 默认files 支持videos/voices/images方法验证
                    'pick' => [
                        'multiple' => false,
                    ]
                ]
            ]);?>
            <?= $form->field($model, 'name')->textInput() ?>
            <?= $form->field($model, 'desc')->textarea() ?>
            <?= $form->field($model, 'background')->widget('common\widgets\webuploader\Files', [
                'type' => 'files',
                'config' => [ // 配置同图片上传
                    // 'server' => \yii\helpers\Url::to(['file/files']), // 默认files 支持videos/voices/images方法验证
                    'pick' => [
                        'multiple' => false,
                    ]
                ]
            ]);?>

            <?= $form->field($model, 'sex')->radioList(GenderEnum::getMap()) ?>
            <?= $form->field($model, 'birthday')->widget('kartik\date\DatePicker', [
                'language' => 'zh-CN',
                'layout' => '{picker}{input}',
                'pluginOptions' => [
                    'format' => 'yyyy-mm-dd',
                    'todayHighlight' => true,// 今日高亮
                    'autoclose' => true,// 选择后自动关闭
                    'todayBtn' => true,// 今日按钮显示
                ],
                'options' => [
                    'class' => 'form-control no_bor',
                ]
            ]); ?>
            <?= \common\widgets\provinces\Provinces::widget([
                'form' => $form,
                'model' => $model,
                'template' => 'short',
                'provincesName' => 'province_id',// 省字段名
                'cityName' => 'city_id',// 市字段名
                'areaName' => 'area_id',// 区字段名
            ]); ?>
            <?= $form->field($model, 'release_num')->textInput() ?>
            <?= $form->field($model, 'praised_num')->textInput() ?>
            <?= $form->field($model, 'fans_num')->textInput() ?>
            <?= $form->field($model, 'follow_num')->textInput() ?>
            <?= $form->field($model, 'identity')->textInput() ?>
            <?= $form->field($model, 'recommend')->radioList(GenderEnum::getRecommend()) ?>
            <?= $form->field($model, 'sorts')->textInput() ?>
            <?= $form->field($model, 'status')->radioList(StatusEnum::getMap()) ?>
        </div>
        <div class="modal-footer">
            <span class="btn btn-white" onclick="history.go(-1)">返回</span>
            <button class="btn btn-primary" type="submit">保存</button>
        </div>
    </div>

<?php ActiveForm::end(); ?>